const UrlHead=getApp().globalData.requestUrl;

module.exports = (action, data,method) => {
  var Openid=getApp().globalData.wxopenid;
  var headers={};
  if(method=='get'){
    headers={ 'Content-Type': 'application/json', 'openid': Openid}
  }else if(method=='post'){
    headers={ 'Content-Type': 'application/x-www-form-urlencoded', 'openid': Openid}
  }
  return new Promise((resolve, reject) => {
    wx.request({
      url:UrlHead+ action,
      data: data,
      header: headers,
      method: method,
      success: resolve,
      fail: reject
    })
  })
}